<?php session_start();
validaAcesso();
require_once"funcoes/com_aquisicao.jsp";
require_once"funcoes/com_idiomas.jsp";
require_once"funcoes/bibl_colecoes_periodicos.jsp";

if(isset($_GET[atualiza])==1){
    $hj = date("Y-m-d");
    setColPeriodico($_POST["pcodigo"],$_POST["pbibl_edit_prod"],$_POST["paquisicao"],$_POST["pclassific"],$_POST["pbibl_genero"],$_POST["ptitulo"],$hj,
                    $_POST["pano_ini_ass"]."-".$_POST["pmes_ini_ass"]."-".$_POST["pdia_ini_ass"],
                    $_POST["pano_fim_ass"]."-".$_POST["pmes_fim_ass"]."-".$_POST["pdia_fim_ass"],
                    $_POST["pid_hostel"],$_POST["pissn"],$_POST["pcircula"],$_SESSION["loginCK_"],$_POST["pareamec"],$_POST["pidioma"],
                    $_POST["plocal"],$_POST["pesc2"],$_POST["pesc4"]);
}

if(isset($_GET[exc])==1){       delColPeriodico($_GET["pcodigo"]);}


if($_GET["cont"] == 1){
$col = getColPeriodico($_GET["pcodigo"], "input");

list($inia,$inim,$inid) = explode("-", $col[7]);
list($fima,$fimm,$fimd) = explode("-", $col[8]);

        if($col[11]=="S"){
           $S="checked";
        }else{
           $N="checked";
        }

?>

          <script type="text/javascript" src="css2/ajax/ajax.js"></script>
          <script type="text/javascript" src="css2/ajax/ajax-dynamic-list2.js"></script>
          <link rel="stylesheet" type="text/css" href="css2/list-select.css" media="screen">
          <script type="text/javascript" src="css2/tooltip.js"></script>
          <link rel="stylesheet" type="text/css" href="css2/tooltip.css" media="screen">
          <script type="text/javascript" src="css2/form_validator.js"></script>


<form method="POST" enctype='multipart/form-data' action="index.jsp?atualiza=1&alt=24" autocomplete="off" name="form1">
<input type='hidden' name='pcodigo' value='<?php echo $_GET["pcodigo"]; ?>'>
<h2>Altera&ccedil;&atilde;o de <?php echo $_SESSION["menu"]["cad"][24]; ?> da institui&ccedil;&atilde;o:<BR>
<select name="pid_hostel">
<?php
	  require_once"funcoes/com_hostels.jsp";
      getHostels($col[9],"select");
?>

</select></h2><BR><BR>

<fieldset class='subgrupo'>
	<legend>Cole&ccedil;&atilde;o</legend>


<div class='item'><h5>T&iacute;tulo:</h5><input type="text" size="50" maxlength="80"  name="ptitulo" value='<?php echo $col[5]; ?>'> <b id='ok'>*</b> exemplo: Veja, Isto&Eacute;</div>
<div class='item'><h5>Editora/Produtora:</h5>
<?php
                require_once"funcoes/bibl_edit_prod.jsp";
                getEditprod($col[1],"ajax");
?>
</div>


<BR>

<div class='item'><h5>G&ecirc;nero:</h5>
<?php
      require_once"funcoes/bibl_genero.jsp";
      getGenero($col[4],"ajax");
?>

</div>

<div class='item'><h5>Classifica&ccedil;&atilde;o <?php retorna_cdu_dewey();?> :</h5><input type="text" size="10" maxlength="10" name="pclassific" value='<?php echo $col[3]; ?>'>  Ex: B869.3</div>
<div class='item'><h5>Idioma:</h5>
<select name='pidioma'>
<?php    getIdioma($col[14],"select"); ?>
</select></div>
<div class='item'><h5>ISSN:</h5><input type="text" size="20" maxlength="30" name="pissn" value='<?php echo $col[10]; ?>'> Ex: 85-352-1057-1 - International Standard Serie Number</div>



<div class='item'><h5>Aquisi&ccedil;&atilde;o:</h5>
<select name="paquisicao">
<?php
     getAquisicao($col[2],"select");
?>
</select> <b id='ok'>*</b></div>

<div class='item'><h5>Data de In&iacute;cio Assinatura:</h5>
<input type="text" size="2" maxlength="2" name="pdia_ini_ass" value="<?php echo $inid; ?>"> /
<input type="text" size="2" maxlength="2" name="pmes_ini_ass" value="<?php echo $inim; ?>"> /
<input type="text" size="4" maxlength="4" name="pano_ini_ass" value="<?php echo $inia; ?>">  Ex: dd/mm/aaaa <i>(preencher somente se houver assinatura)</i></div>
<div class='item'><h5>Data de T&eacute;rmino Assinatura:</h5>
<input type="text" size="2" maxlength="2" name="pdia_fim_ass" value="<?php echo $fimd; ?>"> /
<input type="text" size="2" maxlength="2" name="pmes_fim_ass" value="<?php echo $fimm; ?>"> /
<input type="text" size="4" maxlength="4" name="pano_fim_ass" value="<?php echo $fima; ?>">  Ex: dd/mm/aaaa <i>(preencher somente se houver assinatura)</i></div>





<div class='item'><h5>Pode ser Emprestado: <b id='ok'>*</b></h5>
<input type="radio" name="pcircula" value="S" <?php echo $S; ?>> Sim<BR>
<input type="radio" name="pcircula" value="N" <?php echo $N; ?>> Somente nas depend&ecirc;ncias da Institui&ccedil;&atilde;o</div>

</fieldset>

<?php
if(acessoMenu("campo_localizacao")==1){
?>
<fieldset class='subgrupo'>
	<legend>Localiza&ccedil;&atilde;o</legend>

<div class='item'><h5>Sala:</h5>
<select name='plocal'>
<?php
     require_once"funcoes/bibl_localizacao.jsp";
     getLocal($col[15],"select");
?>
</select></div>

</fieldset>

<?php
 } // fecha localizacao
?>





<?php
if(acessoMenu("campo_areamec")==1){
?>

<fieldset class='subgrupo'>
	<legend>TESAUROS</legend>

<div class='item'><h5>&Aacute;reas Tem&aacute;ticas do Conhecimento (Exigido pelo MEC):</h5>
<select name='pareamec'>
<?php
     require_once"funcoes/bibl_area_mec.jsp";
     getAreamec($col[13],"select");
?>
</select><b id='ok'>*</b></div>



<div class='item'><h5>S&eacute;rie:</h5>
<select name="pesc2">
<option value="">Selecione</option>
<?php
      require_once"funcoes/bibl_serie.jsp";
      getEscolar2($col[16],"select");
?>

</select></div>

<div class='item'><h5>Disciplina:</h5>
<select name="pesc4">
<option value="">Selecione</option>
<?php
      require_once"funcoes/bibl_disciplina.jsp";
      getEscolar4($col[17],"select");
?>

</select></div>
</fieldset>

<?php
 } // fecha campo_areamec
?>


<BR>

<div class='item'><h5></h5><input type="submit" value="Alterar">
     <a class='excluir' href='index.jsp?exc=1&pcodigo=<?php echo $_GET["pcodigo"]; ?>&alt=24'>EXCLUIR</a>
</div>

</form>
<script type="text/javascript">
//<![CDATA[
var f = document.forms[0];
MaskInput(f.pdia_ini_ass, "99");
MaskInput(f.pmes_ini_ass, "99");
MaskInput(f.pano_ini_ass, "9999");
MaskInput(f.pdia_fim_ass, "99");
MaskInput(f.pmes_fim_ass, "99");
MaskInput(f.pano_fim_ass, "9999");

autoTab();


  var valid  = new Validator("form1");
  valid.addValidation("ptitulo","req","Titulo");
  valid.addValidation("pbibl_genero","req","Genero");

  valid.addValidation("pbibl_edit_prod","req","Editora / Produtora");


  valid.addValidation("pdia_ini_ass","numeric");
  valid.addValidation("pdia_fim_ass","numeric");
  valid.addValidation("pmes_ini_ass","numeric");
  valid.addValidation("pmes_fim_ass","numeric")
  valid.addValidation("pano_ini_ass","numeric");
  valid.addValidation("pano_fim_ass","numeric")
  



//]]>
</script>

<?php
}else{
      echo "<h2>Lista de ".$_SESSION["menu"]["cad"][24]." Cadastados:</h2>";
      getColPeriodico(0,"todos", true);
}
?>
